import { UserAuth, UserProfile } from "./user";
import { SkuCard, SkuDetail, SkuSpec, ProductDetail } from "./sku"
import { MerchantInfo } from "./merchant";
import { CartItem } from "./cart";
import { Address } from "./address";
import { CartItemsByMerchant } from "./cart";

type ApiResp<T> =
  | { code: 0; data: T }
  | { code: number; message: string } // 错误类型

type PageResp<T> = ApiResp<{
  items: T[];
  pageNum: number;
  pageSize: number;
  total: number;
}>


type UserRegisterResp = ApiResp<UserProfile>;


type UserLoginResp = ApiResp<UserAuth>;

type SkuCardPageResp = PageResp<SkuCard>;






type ProductDetailResp = ApiResp<ProductDetail>;


type CartItemsResp = PageResp<CartItem>;



type OrderConfirmViewResp = ApiResp<{
  groups: CartItemsByMerchant[];
  addresses: Address[];
  totalPrice: string;
}>;



export type { ApiResp, UserRegisterResp, UserLoginResp, SkuCardPageResp, ProductDetailResp, CartItemsResp, OrderConfirmViewResp  };



